package perf.data;

public class Callcosts extends BaseCost {

	private Function destination;
	private int destinationLine;
	private long callCount;
	
	public Callcosts( Function destination ) {
		this.destination = destination;
	}
	
	public Callcosts( long calls ) {
		this.callCount = calls;
	}
	
	public int getSourceLine() {
		return getLine();
	}

	public void setSourceLine(int sourceLine) {
		setLine( sourceLine );
	}
	
	public long getCalls() {
		return callCount;
	}

	public void setCalls(long calls) {
		this.callCount = calls;
	}

	public void setDestination(Function destination) {
		this.destination = destination;
	}

	public void setDestinationLine(int destinationLine) {
		this.destinationLine = destinationLine;
	}

	public Function getDestination( ) {
		if ( destination == null ) {
			throw new RuntimeException( "destination not defined" );
		}
		return destination;
	}
	
	public int getDestinationLine( ) {
		return destinationLine;
	}
		
	@Override
	public String toString( ) {
		return "{" + callCount + " x " 
				+ destination.getName() + " => " 
				+ super.toString() + "}\n";
	}
}
